home *** CD-ROM | disk | FTP | other *** search
- {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- (c) TechInsite Pty. Ltd.
- PO Box 429, Abbotsford, Melbourne. 3067 Australia
- Phone: +61 3 9419 6456
- Fax: +61 3 9419 1682
- Web: www.techinsite.com.au
- EMail: peter_hinrichsen@techinsite.com.au
-
- Created: Jan 2000
-
- Notes: Popup dialog for editing an address
-
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
- unit FEditAddress;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ExtCtrls, tiButtonPanel, Adrs_BOM, StdCtrls
- ;
-
- type
- TFormEditAddress = class(TForm)
- tiButtonPanel1: TtiButtonPanel;
- cbAddressType: TComboBox;
- eCountry: TEdit;
- mAddress: TMemo;
- eState: TEdit;
- ePostCode: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- procedure tiButtonPanel1Btn1Click(Sender: TObject);
- procedure tiButtonPanel1Btn2Click(Sender: TObject);
- private
- FData: TAddress;
- procedure SetData(const Value: TAddress);
- public
- property Data : TAddress read FData write SetData ;
- end;
-
- implementation
-
- {$R *.DFM}
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- // *
- // * TFormEditAddress
- // *
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- procedure TFormEditAddress.SetData(const Value: TAddress);
- begin
-
- FData := Value;
- cbAddressType.ItemIndex := cbAddressType.Items.IndexOf( FData.AdrsType ) ;
- mAddress.Lines.Text := FData.Lines ;
-
- eState.Text := FData.State ;
- ePostCode.Text := FData.PCode ;
- eCountry.Text := FData.Country ;
-
- end;
-
- // The OK button on click event
- //------------------------------------------------------------------------------
- procedure TFormEditAddress.tiButtonPanel1Btn1Click(Sender: TObject);
- begin
- if cbAddressType.ItemIndex = -1 then begin
- cbAddressType.SetFocus ;
- raise exception.Create( 'Please select an address type.' ) ;
- end ;
-
- if mAddress.Lines.Text = '' then begin
- mAddress.SetFocus ;
- raise exception.Create( 'Please enter an address.' ) ;
- end ;
-
- FData.AdrsType := cbAddressType.Items[ cbAddressType.ItemIndex ] ;
- FData.Lines := mAddress.Lines.Text ;
- FData.State := eState.Text ;
- FData.PCode := ePostCode.Text ;
- FData.Country := eCountry.Text ;
- ModalResult := mrOK ;
-
- end;
-
- // Cancel button on click event
- //------------------------------------------------------------------------------
- procedure TFormEditAddress.tiButtonPanel1Btn2Click(Sender: TObject);
- begin
- ModalResult := mrCancel ;
- end;
-
- end.
-